<?php

defined('BASEPATH') OR exit('No direct script access allowed');
/*
|--------------------------------------------------------------------------
| 每日菜谱模型
|@author khj
|--------------------------------------------------------------------------
*/
class DailyMenus extends MY_Controller {

	/**
	 * 每日菜谱模型
	 * @var AdmDailyMenusModel
	 */
	public $mDaily;

	public function __construct(){
		parent::__construct();

		$this->loadModel('AdmDailyMenusModel', 'mDaily', 'admin');
	}

    /**
     * 每日菜谱列表
     */
    public function getList(){
        //表单验证
        $vConf = array(
            array('page', '页码', 'required|is_natural_no_zero')
        );
        $this->formDataValidation($vConf);

        $page = post('page');

        $tA = $this->mDaily->appGetList($page);

        $this->appReturn(1, '', $tA);
    }

    /**
     * 菜谱详情
     */
    public function getInfo(){
        //表单验证
        $vConf = array(
            array('id', '菜谱id', 'required|is_natural_no_zero')
        );
        $this->formDataValidation($vConf);

        $id = post('id');

        $tA = $this->mDaily->getInfo($id);

        if(!$tA){
            $this->appReturn(0, '菜谱不存在');
        }

        unset($tA['pic_og']);

        $html = $this->view('dailyMenus/details',['info'=>$tA],0,0,0,true);
        $data = array(
            'content' => $html
        );
        $this->appReturn(1,'',$data);

    }

	

}
	